114 research outputs found

    EERTREE: An Efficient Data Structure for Processing Palindromes in Strings

    Full text link
    We propose a new linear-size data structure which provides a fast access to all palindromic substrings of a string or a set of strings. This structure inherits some ideas from the construction of both the suffix trie and suffix tree. Using this structure, we present simple and efficient solutions for a number of problems involving palindromes.Comment: 21 pages, 2 figures. Accepted to IWOCA 201

    Palindromic k-Factorization in Pure Linear Time

    Get PDF
    Given a string s of length n over a general alphabet and an integer k, the problem is to decide whether s is a concatenation of k nonempty palindromes. Two previously known solutions for this problem work in time O(kn) and O(nlog n) respectively. Here we settle the complexity of this problem in the word-RAM model, presenting an O(n)-time online deciding algorithm. The algorithm simultaneously finds the minimum odd number of factors and the minimum even number of factors in a factorization of a string into nonempty palindromes. We also demonstrate how to get an explicit factorization of s into k palindromes with an O(n)-time offline postprocessing

    Palindromic Length of Words with Many Periodic Palindromes

    Full text link
    The palindromic length PL(v)\text{PL}(v) of a finite word vv is the minimal number of palindromes whose concatenation is equal to vv. In 2013, Frid, Puzynina, and Zamboni conjectured that: If ww is an infinite word and kk is an integer such that PL(u)k\text{PL}(u)\leq k for every factor uu of ww then ww is ultimately periodic. Suppose that ww is an infinite word and kk is an integer such PL(u)k\text{PL}(u)\leq k for every factor uu of ww. Let Ω(w,k)\Omega(w,k) be the set of all factors uu of ww that have more than k1uk\sqrt[k]{k^{-1}\vert u\vert} palindromic prefixes. We show that Ω(w,k)\Omega(w,k) is an infinite set and we show that for each positive integer jj there are palindromes a,ba,b and a word uΩ(w,k)u\in \Omega(w,k) such that (ab)j(ab)^j is a factor of uu and bb is nonempty. Note that (ab)j(ab)^j is a periodic word and (ab)ia(ab)^ia is a palindrome for each iji\leq j. These results justify the following question: What is the palindromic length of a concatenation of a suffix of bb and a periodic word (ab)j(ab)^j with "many" periodic palindromes? It is known that PL(uv)PL(u)PL(v)\lvert\text{PL}(uv)-\text{PL}(u)\rvert\leq \text{PL}(v), where uu and vv are nonempty words. The main result of our article shows that if a,ba,b are palindromes, bb is nonempty, uu is a nonempty suffix of bb, ab\vert ab\vert is the minimal period of abaaba, and jj is a positive integer with j3PL(u)j\geq3\text{PL}(u) then PL(u(ab)j)PL(u)0\text{PL}(u(ab)^j)-\text{PL}(u)\geq 0

    Palindromic length in linear time

    Get PDF
    Palindromic length of a string is the minimum number of palindromes whose concatenation is equal to this string. The problem of finding the palindromic length drew some attention, and a few O(nlogn)O(n\log n) time online algorithms were recently designed for it. In this paper we present the first linear time online algorithm for this problem.Peer reviewe

    EERTREE: An efficient data structure for processing palindromes in strings

    Full text link
    We propose a new linear-size data structure which provides a fast access to all palindromic substrings of a string or a set of strings. This structure inherits some ideas from the construction of both the suffix trie and suffix tree. Using this structure, we present simple and efficient solutions for a number of problems involving palindromes. © 2017 Elsevier Lt

    The Number of Distinct Subpalindromes in Random Words

    Full text link
    We prove that a random word of length n over a k-Ary fixed alphabet contains, on expectation, Θ(√n) distinct palindromic factors. We study this number of factors, E(n, k), in detail, showing that the limit limn→∞(n,k)/√n does not exist for any k ≥ 2, liminfn→∞(n,k)/ √n=Θ(1), and limsupn→∞(n,k)/ √n=Θ(k). Such a complicated behaviour stems from the asymmetry between the palindromes of even and odd length. We show that a similar, but much simpler, result on the expected number of squares in random words holds. We also provide some experimental data on the number of palindromic factors in random words

    Palk is linear recognizable online

    Full text link
    Given a language L that is online recognizable in linear time and space, we construct a linear time and space online recognition algorithm for the language L・Pal, where Pal is the language of all nonempty palindromes. Hence for every fixed positive k, Palk is online recognizable in linear time and space. Thus we solve an open problem posed by Galil and Seiferas in 1978. © Springer-Verlag Berlin Heidelberg 2015

    Detecting One-variable Patterns

    Full text link
    Given a pattern p=s1x1s2x2sr1xr1srp = s_1x_1s_2x_2\cdots s_{r-1}x_{r-1}s_r such that x1,x2,,xr1{x,x}x_1,x_2,\ldots,x_{r-1}\in\{x,\overset{{}_{\leftarrow}}{x}\}, where xx is a variable and x\overset{{}_{\leftarrow}}{x} its reversal, and s1,s2,,srs_1,s_2,\ldots,s_r are strings that contain no variables, we describe an algorithm that constructs in O(rn)O(rn) time a compact representation of all PP instances of pp in an input string of length nn over a polynomially bounded integer alphabet, so that one can report those instances in O(P)O(P) time.Comment: 16 pages (+13 pages of Appendix), 4 figures, accepted to SPIRE 201

    Repetitions in infinite palindrome-rich words

    Full text link
    Rich words are characterized by containing the maximum possible number of distinct palindromes. Several characteristic properties of rich words have been studied; yet the analysis of repetitions in rich words still involves some interesting open problems. We address lower bounds on the repetition threshold of infinite rich words over 2 and 3-letter alphabets, and construct a candidate infinite rich word over the alphabet Σ2={0,1}\Sigma_2=\{0,1\} with a small critical exponent of 2+2/22+\sqrt{2}/2. This represents the first progress on an open problem of Vesti from 2017.Comment: 12 page
    corecore